﻿using Microsoft.AspNetCore.Mvc.Filters;

namespace AspNetCoreWebApiRoute.Filter
{
    public class MyActionFilterAttribute : ActionFilterAttribute
    {
        public MyActionFilterAttribute() 
        {
        
        }

        public ILogger<MyActionFilterAttribute> logger { get; set; }
        public MyActionFilterAttribute(ILogger<MyActionFilterAttribute> logger)
        {
          
        }
        //public ILogger<MyActionFilterAttribute> logger { get; set; }
        //public MyActionFilterAttribute(ILogger<MyActionFilterAttribute> logger)
        //{
        //    this.logger= logger;
        //}

        public override void OnActionExecuting(ActionExecutingContext context)
        {
            Console.WriteLine("执行过滤器之前");
        }

        public override void OnActionExecuted(ActionExecutedContext context)
        {
            Console.WriteLine("执行过滤器之后");
        }
    }
}
